using System;
using System.Xml;
using System.Xml.Xsl;

/*	-----------------------------------------------------------------------	
	Copyright:	umlungu consulting (pty) ltd
	Author:		Alan Benington	
	Started:	2006-03-08	
	Status:		release	
	Version:	1.0.2.20060310
	License:	GNU General Public License
	-----------------------------------------------------------------------	*/
	
namespace umlungu.engineX.blogX {
	/// <summary>
	/// umlungu engineX blog page class.
	/// </summary>
	public class commentX : blogpageX {
		#region Invisible properties
		private string _commentauthor, _commenttitle, _commenttext;
		#endregion

		#region Visible properties
		#endregion

		#region Constructors/Destructors
		/// <summary>Constructor</summary>
		public commentX() : base("commentX") {
		}
		#endregion

		#region Protected methods
		/// <summary>
		/// Loads the additional comment information and adds to the blog, before continuing with the page display. 
		/// </summary>
		protected override void _LoadAdditional() {
			loadComment();
			postComment();
		}
		#endregion

		#region Private methods
		private void postComment() {
			x_blog blogx = new x_blog(Application);
			if (Archive == "")
				blogx.AddComment(Name, Topic, System.Convert.ToInt32(BlogID), "public", _commentauthor, _commenttitle, _commenttext);
			else
				blogx.AddComment(Name, Topic, Archive, System.Convert.ToInt32(BlogID), "public", _commentauthor, _commenttitle, _commenttext);
		}
		private void loadComment() {
			_commentauthor = (Request.Form["Comment_name"] == null)? "[unknown author]": Request.Form["Comment_name"];
			_commenttitle = (Request.Form["Comment_title"] == null)? "[no title]": Request.Form["Comment_title"];
			_commenttext = (Request.Form["Comment"] == null)? "[no comment]": Request.Form["Comment"];
		}
		#endregion
	}
}
